#pragma once
#include "Board.h"
#include <deque>
#include "ProtocalHelper.h"
using std::deque;

const static int SLOT_COUNT = 17;

class NetNode
{
public:
	NetNode(void);
	~NetNode(void);	
	CString m_name;
	CString m_type;
	DWORD m_IP;    // for connection
	DWORD m_newIP; // for serilizer
	CString m_mac;
	CString m_description;
	int get_slot_count(){ return SLOT_COUNT; }
	Board * get_board( int slot_num );
	int get_slot_num( Board * bd );
	Board * AddBoard( Board& b, int pos );
	void DelBoard( int pos );
	bool modify_ip( DWORD newIP );
	void modify_mac( CString newmac );
	void modify_type( CString newtype );
	void set_board_text( Board * bd, TEXT_INFO info );
	void set_board_time( Board * bd, TIME_INFO info );
	void reset(Board * bd);
	void send_short_cmd(Board * bd, unsigned char * cmd, int len = 8);
	bool is_connected();
	bool connect();
	bool finished();
private:
	deque< Board * > m_boards;
	ProtocalHelper * m_protocal;
public:
	void update_state(void);
	void OnReceive(unsigned char *data, int length );
};
